package org.ufinity.hsms.module.panel.entity;

import java.io.Serializable;
import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class TriggerEntity implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	//
	private String internal;
	//主机名
	private String name;
	//组id
	private String groupid;

	public TriggerEntity(JSONObject json) {
		if (json != null) {
			try {
				internal = json.getString("internal");
				name = json.getString("name");
				groupid = json.getString("groupid");
			} catch (JSONException jsone) {
				
			}
		}
	}
	
	public static ArrayList<TriggerEntity> getList(String sendRequest)
			throws JSONException {
		ArrayList<TriggerEntity> list = null;
		JSONArray jsonArray = new JSONArray(sendRequest);
		if (jsonArray != null && jsonArray.length() >= 0) {
			int length = jsonArray.length();
			list = new ArrayList<TriggerEntity>(length);
			for (int i = 0; i < length; i++) {
				list.add(new TriggerEntity(jsonArray.getJSONObject(i)));
			}
		}
		return list;
	}

	public String getInternal() {
		return internal;
	}

	public void setInternal(String internal) {
		this.internal = internal;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getGroupid() {
		return groupid;
	}

	public void setGroupid(String groupid) {
		this.groupid = groupid;
	}

	
}
